﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PosteSeznam.aspx.cs" Inherits="Sio.Mdm.Web.Instalacija.PosteSeznam" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>SIO - MDM :: Instalacija : Seznam poštnih številk</title>
    <ext:XScript ID="XScript1" runat="server">

        <script type="text/javascript">
    var dodajZapis = function () {
      var grid = #{GridPosteSeznam};
      grid.getRowEditor().stopEditing();    
      grid.insertRecord(0, {
          PostaId: -99,
			    Naziv   : ""
      });
      grid.getView().refresh();
      grid.getSelectionModel().selectRow(0);
      grid.getRowEditor().startEditing(0);
    }
        </script>

    </ext:XScript>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:Viewport ID="Viewport1" runat="server" Layout="Fit">
        <Content>
            <sio:GridPanel ID="GridPosteSeznam" runat="server" StripeRows="true" TrackMouseOver="true">
                <Plugins>
                    <ext:RowEditor ID="RowEditor1" runat="server" SaveText="Shrani" CancelText="Prekliči" ClicksToEdit="2">
                        <DirectEvents>
                            <AfterEdit OnEvent="UrediPodatke">
                                <ExtraParams>
                                    <ext:Parameter Mode="Raw" Name="data" Value="r.data" />
                                </ExtraParams>
                            </AfterEdit>
                        </DirectEvents>
                    </ext:RowEditor>
                    <ext:GridFilters ID="GridFilters1" runat="server">
                        <Filters>
                            <ext:NumericFilter DataIndex="PostaId" />
                            <ext:StringFilter DataIndex="Naziv" />
                            <ext:NumericFilter DataIndex="PostnaStevilka" />
                        </Filters>
                    </ext:GridFilters>
                </Plugins>
                <Store>
                    <ext:Store ID="StorePosteSeznam" runat="server">
                        <SortInfo Field="PostnaStevilka" />
                        <Reader>
                            <ext:JsonReader IDProperty="PostaId">
                                <Fields>
                                    <ext:RecordField Name="PostaId" Type="Int" />
                                    <ext:RecordField Name="Naziv" Type="String" />
                                    <ext:RecordField Name="PostnaStevilka" Type="Int" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModelPoste" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column ColumnID="PostaId" Hidden="true" Hideable="false" DataIndex="PostaId" />
                        <ext:Column ColumnID="PostnaStevilka" Header="Poštna številka" DataIndex="PostnaStevilka"
                            Width="100">
                            <Editor>
                                <ext:NumberField runat="server" AllowBlank="false" MinLength="4" MaxLength="4" MinLengthText="Vpišite poštno številko"
                                    BlankText="Vpišite poštno številko" />
                            </Editor>
                        </ext:Column>
                        <ext:Column Header="Pošta" DataIndex="Naziv" Width="150">
                            <Editor>
                                <ext:TextField runat="server" AllowBlank="false" MinLength="2" MinLengthText="Vpišite naziv pošte"
                                    BlankText="Vpišite naziv pošte" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
                </SelectionModel>
                <TopBar>
                    <ext:Toolbar ID="Toolbar1" runat="server" Width="500">
                        <Items>
                            <sio:Button ID="Button1" runat="server" Text="Dodaj" Icon="Add">
                                <Listeners>
                                    <Click Fn="dodajZapis" />
                                </Listeners>
                            </sio:Button>
                            <sio:Button ID="Button3" runat="server" Text="Briši" Icon="Delete">
                                <DirectEvents>
                                    <Click OnEvent="OdstraniZapise" After="#{StorePosteSeznam}.reload();">
                                        <Confirmation ConfirmRequest="true" Message="Izbrišem izbrane pošte?" />
                                        <ExtraParams>
                                            <ext:Parameter Name="selected" Mode="Raw" Value="Ext.encode(#{GridPosteSeznam}.getRowsValues({selectedOnly:true}))" />
                                        </ExtraParams>
                                    </Click>
                                </DirectEvents>
                            </sio:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
            </sio:GridPanel>
        </Content>
    </ext:Viewport>
    </form>
</body>
</html>
